Skip to content

Remove current directory as arg to pytest#106

Merged
grovduck merged 1 commit intomainfrom
hatch-pytest
Feb 4, 2026
Merged

Remove current directory as arg to pytest#106
grovduck merged 1 commit intomainfrom
hatch-pytest

Conversation

@grovduck
Copy link
Member

@grovduck grovduck commented Feb 4, 2026

As of pytest>9.0, using pytest . {args} as the hatch script for test:all no longer allows specification of a subset of tests to run at command line. For example:

hatch run test:all ./tests/test_regressions.py

will run all tests in the test suite and not just the tests in test_regressions.py. This PR simply removes the current directory (.) as a command-line argument to both test:all and test:coverage scripts which fixes the issue.

@aazuspan, in my limited searching, I couldn't find a specific issue/PR in pytest that noted this change. I came across it when I updated the packages in my hatch test environment as part of some testing on #99. I think this is an OK fix, but let me know if there is a better way to get around this issue.

@grovduck grovduck requested review from aazuspan and Copilot February 4, 2026 16:41
@grovduck grovduck self-assigned this Feb 4, 2026
@grovduck grovduck added the bug Something isn't working label Feb 4, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a compatibility issue with pytest 9.0+ where specifying a subset of tests to run at the command line was not working due to the presence of . (current directory) as an explicit argument in the hatch test scripts.

Changes:

  • Removed . argument from test:all and test:coverage hatch scripts in pyproject.toml, allowing pytest arguments to be properly passed through

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@aazuspan aazuspan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I'm a little surprised that it worked before, since it seems like it would have been called with two paths...

This looks like a good fix, since calling pytest with no path runs everything. I tested locally and everything worked as expected in both 8.4.1 and 9.0.2.

@grovduck grovduck merged commit d9c1512 into main Feb 4, 2026
17 checks passed
@grovduck
Copy link
Member Author

grovduck commented Feb 4, 2026

Thanks, @aazuspan. Merged!

@grovduck grovduck deleted the hatch-pytest branch February 5, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants